object Functions {
  def addOne(list: List[Int]): List[Int] = {
    list.map(_ + 1)
  }
  def filterEven(list: List[Int]): List[Int] = {
    list.filter(_ % 2 == 0)
  }
  def mapReduce(list: List[Int])(mapFunc: Int => Int)(reduceFunc: (Int, Int) => Int): Int = {
    list.map(mapFunc).reduce(reduceFunc)
  }
}

object pj3main {
  def main(args: Array[String]): Unit = {
    val list=List(1,2,3,4,5,6,7,8,9,10)
    val addOneList=Functions.addOne(list)
    println(addOneList)
    val evenList=Functions.filterEven(list)
    println(evenList)
    val sum=Functions.mapReduce(list)(x=>x*2)(_+_)
    println(sum)
  }
}
